<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>WinCache Functions Reroutes</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="wincache.sessionhandler.html">« WinCache Session Handler</a></li>
      <li style="float: right;"><a href="wincache.resources.html">资源类型 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="wincache.setup.html">安装/配置</a></li>
    <li>WinCache Functions Reroutes</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="wincache.reroutes" class="section">
  <h2 class="title">WinCache Functions Reroutes</h2>
  <p class="para">
   <em class="emphasis">NOTE:</em> <a href="wincache.configuration.html#ini.wincache.rerouteini" class="link">wincache.rerouteini</a> was removed as of 
   WinCache 1.3.7.0.  It has been replaced with automatic function reroutes.  See: 
   <a href="wincache.configuration.html#ini.wincache.reroute_enabled" class="link">wincache.reroute_enabled</a>.
  </p>
  <p class="para">
   The WinCache functions reroutes (available since WinCache 1.2.0, removed since WinCache 1.3.7.0) can be used to replace built-in PHP functions with their equivalents 
   that are optimized for a particular purpose. WinCache extension includes Windows-optimized implementation of PHP file functions that 
   may improve performance of PHP applications in cases when PHP has to access files on network shares. The optimized implementation is 
   provided for the following functions:
  </p>
  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     <a href="function.file-exists.html" class="link">file_exists</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.file-get-contents.html" class="link">file_get_contents</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.readfile.html" class="link">readfile</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.is-readable.html" class="link">is_readable</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.is-writable.html" class="link">is_writable</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.is-dir.html" class="link">is_dir</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.realpath.html" class="link">realpath</a>
    </span>
   </li>
      <li class="listitem">
    <span class="simpara">
     <a href="function.filesize.html" class="link">filesize</a>
    </span>
   </li>
  </ul>
  <p class="para">
   To configure WinCache to use the functions reroutes use the file <var class="filename">reroute.ini</var> that is included in 
   WinCache installation package. Copy this file into the same directory where <var class="filename">php.ini</var> 
   file is located. After that add the wincache.rerouteini setting in <var class="filename">php.ini</var> 
   and specify an absolute or relative path to the <var class="filename">reroute.ini</var> file.
   <div class="example" id="example-651">
    <p><strong>示例 #1 Enabling WinCache functions reroutes</strong></p>
    <div class="example-contents">
<div class="php.inicode"><pre class="php.inicode">wincache.rerouteini = C:\PHP\reroute.ini</pre>
</div>
    </div>

   </div>
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <span class="simpara">
    If WinCache functions reroutes are enabled it is recommended to increase the WinCache file cache size. This 
    can be done by using <a href="wincache.configuration.html#ini.wincache.fcachesize" class="link">wincache.fcachesize</a> setting.
   </span>
  </p></blockquote>
  <p class="para">
   The <var class="filename">reroute.ini</var> file contains the mappings between the native PHP functions and 
   their equivalents in WinCache. Each line in the file defines a mapping by using the following syntax:
  </p>
  <p class="simpara">
   <code class="literal">&lt;PHP function name&gt;:[&lt;number of function parameters&gt;]=&lt;wincache function name&gt;</code>
  </p>
  <p class="para">
   The example of the file is shown below. In this example the calls to PHP function <span class="function"><a href="function.file-get-contents.html" class="function">file_get_contents()</a></span> 
   will be replaced with calls to <span class="function"><strong>wincache_file_get_contents()</strong></span> only if the number of parameters passed to 
   the function is less than or equals to 2. Specifying the number of parameters is useful when replacement function 
   does not handle all the function&#039;s parameters.
   <div class="example" id="example-652">
    <p><strong>示例 #2 Reroute.ini file content</strong></p>
    <div class="example-contents">
 <div class="php.inicode"><pre class="php.inicode">[FunctionRerouteList]
file_exists=wincache_file_exists
file_get_contents:2=wincache_file_get_contents
readfile:2=wincache_readfile
is_readable=wincache_is_readable
is_writable=wincache_is_writable
is_writeable=wincache_is_writable
is_file=wincache_is_file
is_dir=wincache_is_dir
realpath=wincache_realpath
filesize=wincache_filesize</pre>
</div>
    </div>

   </div>
  </p>
 </div></div></div></body></html>